﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Collections.Generic;
using Yipusoft.Account.Model;

public partial class Home3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        UserInfo user = Yipusoft.Account.BLL.User.GetUser(Context.User.Identity.Name);
        if (user.DepartmentID.Substring(0, 4).Equals("1300"))
        {

            //总队司政后防
            if (user.DepartmentID.Substring(5, 1) == "1")
            {
                return;
            }
            else if (user.DepartmentID.Substring(5, 1) == "4")
            {
                Response.Redirect("Home6.aspx");
            }
            else if (user.DepartmentID.Substring(5, 1) == "2")
            {
                Response.Redirect("Home7.aspx");
            }
            else if (user.DepartmentID.Substring(5, 1) == "3")
            {
                Response.Redirect("Home8.aspx");
            }
            else if (user.DepartmentID.Substring(5, 1) == "5")
            {
                Response.Redirect("HomeXCZX.aspx");
            }
            else
            {
                Response.Redirect("Home4.aspx");
            }
        }
        else if (user.DepartmentID.Substring(0, 4) != "1300" && user.DepartmentID.Substring(4, 1) == "0")
        {

            if (user.DepartmentID.Substring(5, 1) == "0")
            {
                Response.Redirect("HomeZhidu/Home.aspx");
            }
            //司令处
            if (user.DepartmentID.Substring(5, 1) == "1")
            {
                Response.Redirect("HomeZhidu/Slb.aspx");
            }//政治处
            else if (user.DepartmentID.Substring(5, 1) == "2")
            {
                Response.Redirect("HomeZhidu/zzb.aspx");
            }
            //后勤处
            else if (user.DepartmentID.Substring(5, 1) == "3")
            {
                Response.Redirect("HomeZhidu/hqb.aspx");
            }//防火处
            else if (user.DepartmentID.Substring(5, 1) == "4")
            {
                Response.Redirect("HomeZhidu/fhb.aspx");

            }//宣传科
            else if (user.DepartmentID.Substring(5, 1) == "5")
            {
                Response.Redirect("HomeZhidu/xck.aspx");
            }
        }
        //中队
        if (user.DepartmentID.Substring(4, 1).Equals("3"))
            Response.Redirect("Homezhongdu.aspx");
        else
            //大队
            if (user.DepartmentID.Substring(4, 1).Equals("2"))
                Response.Redirect("DaDuHome.aspx");
            else
            {
                if (user.DepartmentID.Substring(5, 1) == "1")
                {

                    Response.Redirect("Home3.aspx");
                }
                else
                {
                    Response.Redirect("Home4.aspx");
                }
            }


    }
    public string GetDepartment()
    {
        return Yipusoft.Account.BLL.Department.GetDepartment(Yipusoft.Account.BLL.User.GetUser(User.Identity.Name).DepartmentID).FullName;
    }
}
